import player from "@/game/player";
import { onMounted, reactive, ref } from "vue"
const useCountryName = (emit) => {
    const countryName = ref('');
    const shownCountryNameList = reactive([]);
    const reset = () => {
        shownCountryNameList.splice(0, Infinity, ...player.randomGetCountryNames(8))
        countryName.value = '';
        emit('change-name', '');
    }
    const changeName = (name: string) => {
        countryName.value = name;
        emit('change-name', countryName.value);
    }
    onMounted(() => {
        reset()
    })
    return { countryName, shownCountryNameList, reset, changeName }
}
export default useCountryName